package com.warm.system.service.impl;

import com.warm.common.DBTypeEnum;
import com.warm.common.DS;
import com.warm.system.entity.Order;
import com.warm.system.mapper.OrderMapper;
import com.warm.system.service.OrderService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;
import java.util.List;


@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
    @Autowired
    private OrderMapper orderMapper;
    
    @DS(DBTypeEnum.db2)
    @Override
    public List<Order> getOrderList() {
        return selectList(null);
    }

    @Override
    public BigDecimal getOrderPriceByUserId(Integer userId) {
        return orderMapper.getPriceByUserId(userId);
    }

	@Override
	@Transactional
	@DS(DBTypeEnum.db2)
	public void saveOrder(Order order) {
		super.baseMapper.insert(order);
//		int i=1 /0;
	}
}
